package com.syh.bishe.controller;


import com.syh.bishe.Util.UserHolder;
import com.syh.bishe.pojo.Log;
import com.syh.bishe.pojo.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import com.syh.bishe.service.ILogService;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author syh
 * @since 2024-07-06
 */
@RestController
@Tag(name = "LogController", description = "系统日志模块")
@RequestMapping("/log")
@RequiredArgsConstructor
public class LogController {
    private final ILogService logService;
    @GetMapping("/get")
    @Operation(summary = "获取日志")
    public Result getLog() {
        List<Log> list = logService.list();
        return Result.success(list);
    }
    @GetMapping("/getActivity")
    @Operation(summary = "获取用户行为")
    public Result getActivity() {
        List<Log> list = logService.getSome(UserHolder.getUser().getCompanyId());
        return Result.success(list);
    }
}
